SELECT
<#assign prefixName=' '>
<#if (select__id??)>
${prefixName} T.ID AS id
	<#assign prefixName=','>
</#if>
<#if (select__endDaTi??)>
${prefixName} T.END_DA_TI AS endDaTi
	<#assign prefixName=','>
</#if>
<#if (select__beginDaTi??)>
${prefixName} T.BEGIN_DA_TI AS beginDaTi
	<#assign prefixName=','>
</#if>
<#if (select__departmentId??)>
${prefixName} T.DEPARTMENT_ID AS departmentId
	<#assign prefixName=','>
</#if>
<#if (select__languageId??)>
${prefixName} T.LANGUAGE_ID AS languageId
	<#assign prefixName=','>
</#if>
<#if prefixName == ' '>
  T.ID AS id
, T.END_DA_TI AS endDaTi
, T.BEGIN_DA_TI AS beginDaTi
, T.DEPARTMENT_ID AS departmentId
, T.LANGUAGE_ID AS languageId
</#if>
FROM FD_DEPARTMENT_LA T
<#include "whereDepartmentLaBy1.ftl">
<#assign prefixName='ORDER BY'>
<#if (order__by__id??)>
${prefixName} T.ID ${order__by__id__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__endDaTi??)>
${prefixName} T.END_DA_TI ${order__by__endDaTi__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__beginDaTi??)>
${prefixName} T.BEGIN_DA_TI ${order__by__beginDaTi__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__departmentId??)>
${prefixName} T.DEPARTMENT_ID ${order__by__departmentId__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__languageId??)>
${prefixName} T.LANGUAGE_ID ${order__by__languageId__value!}
	<#assign prefixName=','>
</#if>
